import io.netty.channel.ChannelHandlerContext;

public class PongMessageResolver extends Resolver {
    @Override
    boolean support(IMessage iMessage) {
        return MessageTypeEnum.PONG.equals(iMessage.getType());
    }

    @Override
    IMessage resolver(IMessage iMessage, ChannelHandlerContext ctx) {
        // 接收到pong消息后，不需要进行处理，直接返回一个空的message
        System.out.println("receive pong message: " + System.currentTimeMillis());
        IMessage empty = new IMessage();
        empty.setType(MessageTypeEnum.EMPTY);
        return empty;
    }
}
